package digester;

import java.io.IOException;

import org.apache.commons.digester.Digester;
import org.apache.commons.digester.xmlrules.DigesterLoader;
import org.xml.sax.SAXException;

public class Test {

	/**
	 * @param args
	 * @throws SAXException 
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException, SAXException {
		//创建degister解析器
		Digester digester = DigesterLoader.createDigester(Test.class.getClassLoader().getResource("digester/rule.xml"));
		//创建根元素所对应的配置类的实例
		ClassBean cb=new ClassBean();
		//开始解析
		digester.push(cb);
		digester.parse(Test.class.getClassLoader().getResource("digester/class.xml"));
		//测试
		System.out.println(cb);
		System.out.println(cb.findStudentBean("1"));
		System.out.println(cb.findTeacherBean("1"));
	}
}
